package server;

import java.net.ServerSocket;
import java.net.Socket;

/**
 *
 * @author Sasa
 */
public class Server {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws Exception {

	// Start socket
	ServerSocket ss = new ServerSocket(9876);

	System.out.println("Server is up and running at port: " + ss.getLocalPort());

	DataBase db = new DataBase();


	while (true) {
	    Socket socket = ss.accept();
	    socket.setKeepAlive(true);
	    System.out.println("Connected with: " + socket.getInetAddress());

	    Thread t = new Thread(new Requests(socket, db));
	    t.start();
	}
    }
}
